#include<reg51.h>
unsigned char seg[] = {0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
unsigned int num = 0;
unsigned int dat;
unsigned int cnt = (65536-49800 * 11.0592/12);

void delay(int i)
{
int k,j;
for(k = 0;k < i;k ++)
for(j = 0;j < 200;j ++);
}
void display()
{
int n = 5;
P2 = 0xfe;
P0 = seg[dat % 10];
delay(n);
P2 = 0xfd;
P0 = seg[dat % 100/10];
delay(n);
P2 = 0xfb;
P0 = seg[dat % 1000/100];
delay(n);
P2 = 0xf7;
P0 = seg[dat % 10000/1000];
delay(n);
P2 = 0xef;
P0 = seg[dat/10000];
delay(n);
}
/* ?******************************? */
void main()
{
TMOD = 0X51;
TH0 = 0X4c;
TL0 = 0X18;
ET0 = 1;
EA = 1;
TR0 = 1;
TR1 = 1;
while(1)
display();
}

void t_0() interrupt 1
{
num++;
if(num == 20)
{
num = 0;
TR1 = 0;
dat = TH1;
dat <<= 8;
dat += TL1;
TH1 = 0;
TL1 = 0;
TR1 = 1;
}
TH0 = 0x4c;
TL0 = 0x18;
}